﻿<%@ Page Title="Справочник должностей" Language="C#" MasterPageFile="~/Root.master" AutoEventWireup="true" CodeFile="post.aspx.cs" Inherits="Post" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="Server">
    <script src="../Scripts/toolbar.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        // <![CDATA[
        function onMenuClick(s, e) {
            switch (e.item.index) {
                case 0:
                    cbPanel.PerformCallback('Add');
                    break;
                case 1:
                    cbPanel.PerformCallback('Edit');
                    break;
                case 2:
                    cbPanel.PerformCallback('Delete');
                    break;
            }
        }
        // ]]>
    </script>
    <div class="pageLabel">
        <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Права доступа" Font-Size="Medium" Theme="iOS">
        </dx:ASPxLabel>
    </div>
    <div style="float: left; margin-left: 10px;">

        <dx:ASPxMenu ID="mMenu" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
            SeparatorHeight="15px" ItemSpacing="1px">
            <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
            <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_post); }" />
            <Items>
                <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                    <Image Url="~/Images/shared/edit_add.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                    <Image Url="~/Images/shared/edit.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                    <Image Url="~/Images/shared/editdelete.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_settings" Name="btn_column" Text="" ToolTip="Настройка колонок">
                    <Image Url="~/Images/shared/group.png">
                    </Image>
                </dx:MenuItem>
            </Items>
        </dx:ASPxMenu>
    </div>
    <dx:ASPxMenu ID="menu_exp" runat="server" OnItemClick="menu_exp_ItemClick">
        <Items>
            <dx:MenuItem Name="btn_Excel" Text="" ToolTip="Экспорт в Excel">
                <Image Url="~/Images/shared/EXCEL.png">
                </Image>
            </dx:MenuItem>
        </Items>
    </dx:ASPxMenu>
    <div style="float: left; margin-right: 10px; margin-left: 10px">
        <dx:ASPxGridView ID="grd_post" runat="server" AutoGenerateColumns="False" ClientInstanceName="grd_post" Width="400px"
            DataSourceID="ds_WorkerState" KeyFieldName="CODE" OnRowInserting="grd_post_RowInserting">
            <ClientSideEvents FocusedRowChanged="function(s, e) {
	cbPanel.PerformCallback('select');
}" />
            <Columns>
                <dx:GridViewDataTextColumn FieldName="CODE" Caption="Код" ReadOnly="True" Width="50px"
                    VisibleIndex="0" CellStyle-BackColor="#ffffd6">
                    <EditFormSettings Visible="False" />
                    <CellStyle BackColor="#CCCCCC"></CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="NAME" Caption="Наименование" VisibleIndex="1" Width="270px">
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" ConfirmDelete="True" EnableCustomizationWindow="true" ColumnResizeMode="Control" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
            <SettingsPager AlwaysShowPager="True">
            </SettingsPager>
            <SettingsEditing EditFormColumnCount="1" />
            <Settings ShowFilterRow="True" HorizontalScrollBarMode="Auto" ShowFooter="True" />
        </dx:ASPxGridView>


        <asp:EntityDataSource ID="ds_menu" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="MENU" Select="it.[ID], it.[PARENTID], it.[TEXT]">
        </asp:EntityDataSource>
    </div>
    <div style="float: left">
        <dx:ASPxLabel ID="ASPxLabel4" runat="server" Text="Права доступа" Width="100%" CssClass="blockLabel">
            <Border BorderWidth="2px" />
        </dx:ASPxLabel>

        <dx:ASPxCallbackPanel ID="cbPanel" ClientInstanceName="cbPanel" runat="server" Width="340px" OnCallback="cbPanel_Callback" ShowLoadingPanelImage="False">
            <PanelCollection>
                <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxTreeList ID="TreeList" runat="server" AutoGenerateColumns="False" KeyFieldName="ID" ParentFieldName="PARENTID" PreviewFieldName="TEXT" DataSourceID="dsMenuRight">
                        <Columns>
                            <dx:TreeListTextColumn FieldName="ID" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="0" Visible="False">
                            </dx:TreeListTextColumn>
                            <dx:TreeListTextColumn FieldName="PARENTID" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1" Visible="False">
                            </dx:TreeListTextColumn>
                            <dx:TreeListTextColumn FieldName="TEXT" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="2" Caption="Пункт меню">
                            </dx:TreeListTextColumn>
                            <dx:TreeListCheckColumn Name="Add" ShowInCustomizationForm="True" VisibleIndex="3" FieldName="ISADD" Caption="+" ToolTip="Создание">
                                <PropertiesCheckEdit ValueChecked="1" ValueType="System.Byte" ValueUnchecked="0">
                                </PropertiesCheckEdit>
                            </dx:TreeListCheckColumn>
                            <dx:TreeListCheckColumn FieldName="ISEDIT" ShowInCustomizationForm="True" VisibleIndex="4" Caption="V" ToolTip="Редактирование">
                                <PropertiesCheckEdit ValueChecked="1" ValueType="System.Byte" ValueUnchecked="0">
                                </PropertiesCheckEdit>
                            </dx:TreeListCheckColumn>
                            <dx:TreeListCheckColumn FieldName="ISDELETE" ShowInCustomizationForm="True" VisibleIndex="5" Caption="-" ToolTip="Удаление">
                                <PropertiesCheckEdit ValueChecked="1" ValueType="System.Byte" ValueUnchecked="0">
                                </PropertiesCheckEdit>
                            </dx:TreeListCheckColumn>
                            <dx:TreeListTextColumn FieldName="CODE" ShowInCustomizationForm="True" Visible="False" VisibleIndex="6">
                            </dx:TreeListTextColumn>
                        </Columns>
                        <SettingsBehavior AutoExpandAllNodes="True" AllowFocusedNode="True" />
                        <SettingsSelection Enabled="True" AllowSelectAll="True" Recursive="True" />
                        <SettingsLoadingPanel Enabled="False" />
                        <ClientSideEvents SelectionChanged="function(s, e) {cbPanel.PerformCallback('clear');}" 
                            FocusedNodeChanged="function(s, e) {cbPanel.PerformCallback('focusChange');}" />
                    </dx:ASPxTreeList>
                    <asp:SqlDataSource ID="dsMenuRight" runat="server" ConnectionString="<%$ ConnectionStrings:RegRar %>" ProviderName="<%$ ConnectionStrings:RegRar.ProviderName %>" SelectCommand="GETMENURIGHT" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:Parameter DbType="Int32" DefaultValue="0" Name="ROL" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"></asp:ObjectDataSource>
                    <p></p>
                    <table width="100%">
                        <tr>
                            <td>
                                <dx:ASPxButton ID="bt_save" runat="server" AutoPostBack="False"
                                    Text="Сохранить" Width="100%">
                                    <ClientSideEvents Click="function(s, e) { cbPanel.PerformCallback('saved');}" />
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <div align="right">
                                    <dx:ASPxMenu runat="server" ItemSpacing="1px" SeparatorHeight="15px" SeparatorWidth="2px" EncodeHtml="False" BackColor="Transparent" ID="RightMenu" EnableViewState="False">
                                        <ClientSideEvents ItemClick="function(s, e) { onMenuClick(s, e); }"></ClientSideEvents>

                                        <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png"></SeparatorBackgroundImage>
                                        <Items>
                                            <dx:MenuItem BeginGroup="True" GroupName="grp_edit" Name="btn_Insert" Text="" ToolTip="Права на создание">
                                                <Image Url="~/Images/shared/edit_add.png"></Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Права на редактирование ">
                                                <Image Url="~/Images/shared/edit.png"></Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Права на удаление">
                                                <Image Url="~/Images/shared/editdelete.png"></Image>
                                            </dx:MenuItem>
                                        </Items>
                                    </dx:ASPxMenu>
                                </div>
                            </td>
                        </tr>
                    </table>



                </dx:PanelContent>
            </PanelCollection>
        </dx:ASPxCallbackPanel>

    </div>
    <asp:EntityDataSource ID="ds_WorkerState" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="WORKERSTATE" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>
    <dx:ASPxGridViewExporter ID="grd_export" runat="server" GridViewID="grd_post"></dx:ASPxGridViewExporter>

</asp:Content>

